home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / utility / v11n02.zip / KEYCODE.SCR < prev    next >
Text File  |  1991-12-31  |  2KB  |  60 lines

  1. N KEYCODE.COM
  2. A 100
  3. JMP 0126
  4. DB  " =  "
  5. DB  "      hex     "
  6. DB  "    "
  7. DB  "    decimal",0D,0A,24
  8. MOV AH, 00        ;for extended keyboard, change to MOV AH, 10
  9. INT 16            ;return scan code AH, ascii in AL
  10. MOV BX, AX        ;store in BX.  BX is uneffected by
  11. MOV DL, AL        ;    hexidecimal or decimal routine
  12. MOV AH, 02
  13. INT 21            ;see if ascii printable character
  14. MOV DI, 0106      ;pointer to start of hex template
  15. CALL 0151         ;call hexadecimal routine
  16. MOV AL, BL        ;ascii value in AL
  17. MOV DI, 011A
  18. CALL 0170         ;call decimal routine
  19. MOV AL, BH        ;scan value in AL
  20. MOV DI, 0116
  21. CALL 0170         ;call decimal routine
  22. MOV DX, 0102      ;display all values
  23. MOV AH, 09
  24. INT 21
  25. JMP 0126          ;go again.  Quit with Ctrl-Break
  26. MOV CX, 0404      ;HEXIDECIMAL: counter in CH, rotate value in CL
  27. ROL BX, CL        ;get digit in BL. (Note that 4 rotations
  28. MOV AL, BL        ;     will leave BX unchanged, when done.)
  29. AND AL, 0F        ;zero high bits--do one number at a time
  30. OR AL, 30         ;add 30h, makes display-able ascii value
  31. CMP AL, 3A        ;digit 0-9 if below                       
  32. JL 0162           ;jump to SHOW
  33. ADD AL, 07        ;else make letter A-F
  34. MOV [DI], AL      ;place with DI pointer
  35. INC DI            ;next position right
  36. CMP CH, 03        ;have we got end of scan code?
  37. JNZ 016B
  38. INC DI            ;  if so, then leave one space
  39. DEC CH            ;decrease counter
  40. JNZ 0154          ;if counter not zero, go again
  41. RET
  42. MOV CX, 030A      ;DECIMAL: counter in CH, divisor in CL
  43. XOR AH, AH        ;zero AH
  44. DIV CL            ;divide AL by 0A (10 d), remainder in AH
  45. OR  AH, 30        ;make AH a display-able ascii value
  46. MOV [DI], AH      ;and place with pointer
  47. DEC DI            ;move one posiiton left
  48. DEC CH            ;decrease counter
  49. JZ 018A           ;if counter zero, jump to return
  50. CMP AL, 00        ;still a numerator to work with?
  51. JNZ 0173          ;  if so, go again
  52. MOV BYTE PTR [DI], 20 ;fill out three digits with blanks
  53. JMP 017C          ;      if necessary, to clear work area
  54. RET
  55.  
  56. R CX
  57. 8B
  58. W
  59. Q
  60.